package com.newtouch.bxzs.enterprise.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 客户推送与产品关联mapper
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/2/20 14:27</td>
 * <td>yuanjie</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author yuanjie
 * @version 1.0.0
 * @since 1.0.0
 */
@Mapper
public interface PushCustomerRecordProductMapMapper{

    /**
     * 添加客户推送产品
     * @param product 产品code
     * @param pushCustomerRecordId 推送id
     * @return 添加条数
     */
    @Insert({"<script>" +
            "insert into ASSISTANT_PUSH_CUSTOMER_RECORD_PRODUCT_MAP(PUSH_CUSTOMER_RECORD_PRODUCT_MAP_ID," +
            "PUSH_CUSTOMER_RECORD_ID,PRODUCT_CODE) " +
            " values " +
            " <foreach collection='product' item='item' separator=','> " +
            " (REPLACE(uuid(),'-',''),#{pushCustomerRecordId},#{item} )"+
            " </foreach>"+
            "</script>"})
    int savePushProduct(@Param("product") List<String> product,@Param("pushCustomerRecordId") String pushCustomerRecordId);

}
